#include <assert.h>
#include <string>

//////////////////////////////////////////////////
//Resource
//////////////////////////////////////////////////

template <class Type> class Resource
  {
  public:
    Resource(std::string i_path, std::string i_name);    
	  virtual ~Resource(void);

  private:
    unsigned long m_number_of_references;
    std::string m_path;
    std::string m_name;    
    std::string m_filename; //path + name    

  public:
    std::string GetPath() const;
    std::string GetName() const;
    std::string GetFilename() const;
    unsigned long GetNbOfReferences() const;
    void AddReference();
    void RemoveReference();

  private:
    void SetPath(std::string i_path);
    void SetName(std::string i_name);
    void SetFilename(std::string i_filename);
    void SetReference(unsigned long i_reference);
  };

//////////////////////////////////////////////////

//////////////////////////////////////////////////
//Resource
//////////////////////////////////////////////////

//------------------------------------------------

template <class Type> Resource<Type>::Resource(std::string i_path, std::string i_name)
: m_path(i_path)
, m_name(i_name)
  {
  SetFilename(m_path + m_name);
  SetReference(1);
  }

//------------------------------------------------

template <class Type> Resource<Type>::~Resource()
  {
  }

//------------------------------------------------

template <class Type> std::string Resource<Type>::GetPath() const
  {
  return m_path;
  }

//------------------------------------------------

template <class Type> std::string Resource<Type>::GetName() const
  {
  return m_name;
  }

//------------------------------------------------

template <class Type> std::string Resource<Type>::GetFilename() const
  {
  return m_filename;
  }

//------------------------------------------------

template <class Type> unsigned long Resource<Type>::GetNbOfReferences() const
  {
  return m_number_of_references;
  }

//------------------------------------------------

template <class Type> void Resource<Type>::AddReference()
  {
  m_number_of_references++;
  }

//------------------------------------------------

template <class Type> void Resource<Type>::RemoveReference()
  {
  m_number_of_references--;
  }

//------------------------------------------------  

template <class Type> void Resource<Type>::SetPath(std::string i_path)
  {
  m_path = i_path;
  }

//------------------------------------------------

template <class Type> void Resource<Type>::SetName(std::string i_name)
  {
  m_name = i_name;
  }

//------------------------------------------------

template <class Type> void Resource<Type>::SetFilename(std::string i_filename)
  {
  m_filename = i_filename;
  }

//------------------------------------------------

template <class Type> void Resource<Type>::SetReference(unsigned long i_reference)
  {
  m_number_of_references = i_reference;
  }

//------------------------------------------------

//////////////////////////////////////////////////